// 通用响应接口
export interface ApiResponse<T = any> {
  code: number;
  message: string;
  data: T;
}

// 删除操作响应接口
export interface DeleteResponse {
  code: number;
  message: string;
  requestId: string;
  data: any[];
}

// 分页参数
export interface PageParams {
  page: number;
  pageSize: number;
}

// 分页响应
export interface PageResponse<T> {
  list: T[];
  total: number;
  page: number;
  pageSize: number;
}

// 权限相关类型
export interface UserPermission {
  extraData: Record<string, any>;
  id: number;
  name: string;
  parentId: number;
  path: string;
  remark: string;
  sortId: number;
  type: number;
}

// 用户角色类型
export interface UserRole {
  id: number;
  name: string;
}

// 用户相关类型
export interface User {
  amount: number;
  freezeAmount: number;
  id: number;
  permissions: UserPermission[];
  phone: string;
  roles: UserRole[];
  username: string;
  // 保留原有字段以兼容现有代码
  email?: string;
  avatar?: string;
  role?: string;
  status?: number;
  createTime?: string;
  updateTime?: string;
}

// 账户列表相关类型
export interface Account {
  appID: string;
  email: string;
  locked: number;
  mchNo: string;
  parent: number;
  paymentID: number | null;
  phone: string;
  privateKey: string;
  pwd: string;
  rate: number | null;
  remark: string;
  state: number;
  username: string;
}

// 账户列表请求参数
export interface AccountListParams {
  email?: string;
  page: number;
  parent?: number;
  phone?: string;
  rate?: number;
  size: number;
  state?: number;
  username?: string;
}

// 账户列表响应数据
export interface AccountListResponse {
  data: Account[];
  total: number;
}

export interface LoginParams {
  phone: string;
  pwd: string;
  imageCaptcha: string;
  imageCaptchaId: string;
  secretCode: string;
}

export interface LoginResponse {
  data: {
    token: string;
    ttl: number;
  };
  code: number;
  message: string;
}

// 菜单相关类型
export interface Menu {
  extraData: Record<string, any>;
  id: number;
  name: string;
  parentId: number;
  path: string;
  remark: string;
  sortId: number;
  type: number;
}

// 菜单创建请求参数
export interface MenuCreateParams {
  extraData: Record<string, any>;
  name: string;
  parentId: number;
  path: string;
  remark: string;
  sortId: number;
  type: number;
}

// 菜单更新请求参数
export interface MenuUpdateParams {
  id: number;
  extraData?: Record<string, any>;
  name?: string;
  parentId?: number;
  path?: string;
  remark?: string;
  sortId?: number;
  type?: number;
}

// 菜单列表请求参数
export interface MenuListParams {
  page: number;
  size: number;
  type: number;
}

// 菜单列表响应数据
export interface MenuListResponse {
  data: Menu[];
  total: number;
}

// 角色相关类型
export interface Role {
  cTime: number;
  id: number;
  name: string;
  state: number;
}

// 角色列表请求参数
export interface RoleListParams {
  name?: string;
  page: number;
  size: number;
}

// 角色列表响应数据
export interface RoleListResponse {
  data: Role[];
  total: number;
}

// 权限相关类型
export interface Permission {
  id: number;
  name: string;
  code: string;
  type: string;
  parentId: number;
  children?: Permission[];
}

// 角色授权请求参数
export interface RoleGrantParams {
  roleIds: number[];
  uid: number | null;
}

// 用户编辑请求参数
export interface UserEditParams {
  amount?: number;
  email?: string;
  id: number;
  locked?: number;
  parent?: number;
  paymentID?: number | null;
  phone?: string;
  rate?: number | null;
  remark?: string;
  roleID?: number;
  state?: number;
  username?: string;
}

// USDT出金列表项类型
export interface OutUsdtList {
  amount: number;
  cTime: number;
  id: number;
  managerName: string;
  manageID: number;
  orderID: string;
  payAddress: string;
  rateAmount: number;
  remark: string;
  state: number;
  uTime: number;
  userID: string;
  userName: string;
}

// USDT出金新增请求参数
export interface CreateOutUsdtParams {
  address: string;
  usdt: number;
}

// 操作日志列表项类型
export interface ActionList {
  name: string;
  request: string;
  response: string;
  time: number;
  url: string;
  username: string;
}

// 资金记录列表请求参数
export interface RecordPayListParams {
  amount?: number;
  cTimeDateRange?: number[];
  managerName?: string;
  orderID?: string;
  page: number;
  payName?: string;
  payType?: string;
  size: number;
  type?: number;
  userName?: string;
}

// 资金记录列表项类型
export interface RecordPayList {
  amount: number;
  cTime: number;
  id: number;
  manageID: number;
  managerName: string;
  orderID: string;
  payName: string;
  payType: string;
  type: number;
  userID: number;
  userName: string;
}

// 资金记录列表响应数据
export interface RecordPayListResponse {
  data: RecordPayList[];
  total: number;
}

// 新增银行卡入金请求参数
export interface CreateBankParams {
  account: string;
  amount: number;
  bankName: string;
  bankNum: number;
  bankUnion: number;
  rate:number;
  remark:string;
}
